home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP Products & Services 1994 Summer / NeXTSTEP Products & Services 1994 Summer.iso / AlembicDemo.app / Agent / finish-installation < prev    next >
Text File  |  1993-09-21  |  2KB  |  72 lines

  1. #!/bin/sh
  2.  
  3. if [ `whoami` != root ]; then
  4.     echo You must be root to run this script!
  5.     exit 1
  6. fi
  7.  
  8. if /bin/grep -s '^[^#]*snmpd' /etc/rc; then
  9.     echo Another snmp daemon is already installed.  You will need to disable it by
  10.     echo commenting out some lines in /etc/rc.
  11.     echo
  12. fi
  13.  
  14. if /bin/grep -s '^[^#]*snmpd' /etc/rc.local; then
  15.     if /bin/grep -s '^# Enable Ridgeback snmp daemon.  Do not edit this line!$' /etc/rc.local; then
  16. # Enable Ridgeback snmp daemon.  Do not edit this line!
  17.  
  18.         # This is probably an upgrade.
  19.         echo Ridgeback snmp daemon is already started from /etc/rc.local - no change made.
  20.         MODIFY_RC_LOCAL=-NO-
  21.     else
  22.         echo Another snmp daemon is already installed.  You will need to disable it by
  23.         echo commenting out some lines in /etc/rc.local.
  24.         echo
  25.         MODIFY_RC_LOCAL=-YES-
  26.     fi
  27. else
  28.     # This is probably a fresh installation.
  29.     MODIFY_RC_LOCAL=-YES-
  30. fi
  31.  
  32. if [ $MODIFY_RC_LOCAL = "-YES-" ]; then
  33.     echo Backing up /etc/rc.local to /etc/rc.local.oldRS.
  34.     # Backup user's /etc/rc.local file to /etc/rc.local.oldRS.
  35.     cp -p /etc/rc.local /etc/rc.local.oldRS
  36.  
  37.     echo Modifying /etc/rc.local to start the Ridgeback snmpd automatically on boot up.
  38.     # Add lines to rc.local to start snmp daemon automatically on boot up.
  39.     cat <<END >> /etc/rc.local
  40.  
  41. # Enable Ridgeback snmp daemon.  Do not edit this line!
  42. if [ -f /private/usr/etc/snmpd -a -f /private/usr/etc/snmp/snmpd.conf ]; then
  43.     /private/usr/etc/snmpd /private/usr/etc/snmp/snmpd.conf &
  44.     (echo -n ' snmpd')                    >/dev/console
  45. fi
  46.  
  47. END
  48. fi
  49.  
  50. echo
  51. echo Killing any running snmpd\'s.
  52. /bin/kill `ps ax | grep snmpd | grep -v grep | awk '{ print $1 }'` >&- 2>&1
  53.  
  54. sleep 1
  55. while ps ax | grep snmpd | grep -v grep >&- 2>&1; do
  56.     sleep 1;
  57. done
  58.     
  59. # Do prep run of snmpd to detect run-time errors.
  60. if [ -f /private/usr/etc/snmpd -a -f /private/usr/etc/snmp/snmpd.conf ]; then
  61.     /private/usr/etc/snmpd /private/usr/etc/snmp/snmpd.conf&
  62.     echo New Ridgeback snmpd launched - checking for errors . . . .
  63. else
  64.     echo snmp daemon has not been installed!
  65.     exit 1
  66. fi
  67.  
  68. echo If there are no error messages below, reboot your machine now to use the
  69. echo Ridgeback snmpd!
  70. echo
  71. wait
  72.